def outer_func():
    local_list=[]
    print(local_list)
    def inner_func(name):
        local_list.append(len(local_list)+1)
        print(local_list)
        print ('%s local_list=%s'%(name,local_list))
    return inner_func
clo_func_0 = outer_func()
clo_func_0('clo_func_0')
clo_func_0('clo_func_0')
outer_func()('clo_func_1')
############################################
def my_func(*args):
    fs=[]
    for i in range(3):
        def func():
            return i*i
        # print(func())#0 1 4
        fs.append(func)

    return fs
fs1, fs2, fs3 = my_func()
print (fs1())
print (fs2())
print (fs3())
print (fs1)
print (fs2)
print (fs3)
############
x=1
def func_1():
    x=3
    print(x)
    def func_2():
        print(x)
    return func_2
f=func_1()
f()
# def a():
#     n=1
#     def b():
#
#         # global m
#         m=2
#     def c():
#         o=3
#         print(n,o)
#     b()
#     c()
#
# a()

